/*
 * @Author: 李明明
 * @Date: 2021-03-29 09:11:06
 * @LastEditTime: 2021-03-31 20:57:12
 * @LastEditors: 学渣小宝
 * @Description: 配置文件
 * @FilePath: /zhufeng_egg.js_2103/egg-example/config/config.default.js
 * '
 */
/* eslint valid-jsdoc: "off" */

'use strict';

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_Lmm17600110047';

  // add your middleware config here
  config.middleware = [ 'slow', 'servertime' ,'notfoundHandler'];

  // 文件上传相关
  config.multipart = {
    fileSize: '50mb',
    mode: 'stream',
    fileExtensions: [ '.xls', '.txt', '.pdf' ],
  };

  // 模版引擎
  config.view = {
    defaultExtension: '.nj',
    defaultViewEngine: 'nunjucks',
    mapping: {
      '.nj': 'nunjucks',
      '.hbs': 'handlebars',
      '.ejs': 'ejs',
    },
  }
  config.mongoose = {
    client: {
      url: 'mongodb://127.0.0.1/example',
      options: {}
    }
  }
  config.mysql = {
    client: {
      host: 'localhost',
      port: '3306',
      user: 'root',
      password: 'root',
      database: 'cms',
    }
  }
  config.sequelize = {
    dialect: 'mysql',
    host: '127.0.0.1',
    port: 3306,
    database: 'example',
  }
  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  }
  // config/config.default.js 中自定义错误：
  config.onerror= {
    errorPageUrl: '/public/error.html',
  }
  return {
    ...config,
    ...userConfig,
  };
};
